﻿
using System;
using System.Collections.Generic;
using System.IO;

public class Rezult : HaveToByte
{
    public byte poisk { get; set; }
    public string dt { get; set; }
    public string home { get; set; }
    public string slovo { get; set; }
    public string pos { get; set; }
    public string key { get { return dt + "|" + home + "|" + slovo; } }

    public Rezult()
    {
    }

    public Rezult(BinaryReader br)
    {
        poisk = br.ReadByte();
        dt = BYTE.ToShortString(br);
        home = BYTE.ToShortString(br);
        slovo = BYTE.ToShortString(br);
        pos = BYTE.ToShortString(br);
    }

  
    public byte[] ToByte()
    {
        List<byte> b = new List<byte>();
        b.Add(poisk);
        b.AddRange(ToBYTE.ShortString(dt));
        b.AddRange(ToBYTE.ShortString(home));
        b.AddRange(ToBYTE.ShortString(slovo));
        b.AddRange(ToBYTE.ShortString(pos));
        return b.ToArray();
    }


    public override string ToString()
    {
        return this.home + ":" + this.slovo + Poisk.List[poisk] + "=" + pos;
    }
}